1 : <?php
2 : /*--------------------------------------------------------------------------+
3 : This file is part of eStudy.
4 : forum/classes/class.template.inc.php
5 : - Modulgruppe: Calendar
6 : - Beschreibung: Klasse zur Verwaltung der Templates.
7 : - Version: 0.1, 12/02/2006
8 : - Autor(en): Nadja Krümmel <nadja@kruemmel.info>
9 : +---------------------------------------------------------------------------+
10 : This program is free software; you can redistribute it and/or
11 : modify it under the terms of the GNU General Public License
12 : as published by the Free Software Foundation; either version 2
13 : of the License, or any later version.
14 : +---------------------------------------------------------------------------+
15 : This program is distributed in the hope that it will be useful,
16 : but WITHOUT ANY WARRANTY; without even the implied warranty of
17 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 : GNU General Public License for more details.
19 : You should have received a copy of the GNU General Public License
20 : along with this program; if not, write to the Free Software
21 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 : +--------------------------------------------------------------------------*/
23 :
24 : if ( !defined("TEMPLATE_CLASS") ) {
25 : define( "TEMPLATE_CLASS", "calendar" );
26 :
27 : require_once (PATH_TO_ROOT."calendar/classes/class.functions.inc.php");
28 : /**
29 : * In dieser Datei wird die Klasse Template implementiert.
30 : * @package eStudy.Calendar
31 : * @author Nadja Krümmel <nadja@kruemmel.info>
32 : * @version 0.1, 12/02/2006
33 : */
34 : class Template {
35 : private $szTemplateData;
36 : public function Template($szTemplateName) {
37 23 : if (!file_exists($szTemplateName)) {
38 0 : $this->Halt("unable to load template file: '".$szTemplateName."' does not exist.");
39 0 : }
40 23 : $this->szTemplateData = @implode('', (@file($szTemplateName)));
41 23 : $this->szTemplateData = str_replace('"', '\"', $this->szTemplateData);
42 23 : }
43 : public function getTemplate($szVarname = "") {
44 13 : if ($szVarname) {
45 3 : return ('$'.$szVarname.' .= "'.$this->szTemplateData.'";');
46 : } else {
47 12 : return ('Functions::compress_page("'.$this->szTemplateData.'");');
48 : }
49 : }
50 : public function halt($szErrorMsg) {
51 0 : echo "<pre>Template error:\n ".$szErrorMsg."</pre>";
52 0 : exit;
53 : }
54 : }
55 :
56 : } // define
57 : ?>
|